import Vue from 'vue'
import App from './App'
import VueRouter from "vue-router";
// 扫描路由配置
import router from "./router"
// 导入elementUI
import ElementUI from "element-ui"
// 导入element css
import 'element-ui/lib/theme-chalk/index.css'
// 导入axios
import axios from 'axios'
// 导入常量
import global from './components/Global'
// 导入时间戳
import moment from 'moment'
// 导入全局css
import '@/assets/css/global.css'
// 导入qs
import qs from 'qs'

// 使用
Vue.prototype.axios = axios
Vue.use(ElementUI)


// 异步通信
Vue.prototype.$axios = axios;
// 时间戳 格式化时间
Vue.prototype.$moment = moment;
// 导入常量
Vue.prototype.global = global;
// 导入qs
Vue.prototype.$qs = qs;

Vue.config.productionTip = false

axios.defaults.withCredentials = true



Vue.filter('dateFormat', (dataStr) => {
  var time = new Date(dataStr);

  function timeAdd0(str) {
    if (str < 10) {
      str = '0' + str;
    }
    return str
  }
  var y = time.getFullYear();
  var m = time.getMonth() + 1;
  var d = time.getDate();
  var h = time.getHours();
  var mm = time.getMinutes();
  var s = time.getSeconds();
  return y + '-' + timeAdd0(m) + '-' + timeAdd0(d) + ' ' + timeAdd0(h) + ':' + timeAdd0(mm) + ':' + timeAdd0(s);
});


new Vue({
  el: '#app',
  router,
  render: h => h(App),// ElementUI规定这样使用
})
